import C from '@jingli/config';
import { init } from './model';
import { serverStart, serverInit} from '@jingli/server';
import * as path from 'path';

serverInit({
    name: C.appName,
    cluster: C.cluster,
    entryPath: path.join(__dirname, './http'),
    workerNumbers: 0,
});

async function main() { 
    await init({
        url: C.postgres.url,
        forceSync: false,
    });
    // require('./http');
    await serverStart();
}

main()
    .catch((err) => { 
        console.error(err);
        process.exit(-1);
    })